#include "inc.h"
#include "backtrace.h"

void luaopen_libdemo(lua_State* L);

int main(int argc, char const *argv[])
{
    lua_State* state = luaL_newstate();
    luaL_openlibs(state);
    luaopen_libdemo(state);

    const char* file = "scripts/main.lua";
	//const char* file = "../../../PtoRobot/script/main.lua";
	if (luaL_loadfile(state, file) != 0) {
		printf("load file=%s, error=%s\n", file, lua_tostring(state, -1));
		return -1;
	}

	if (lua_xpcall(state, 0, LUA_MULTRET, 0) != 0) {
        printf("ssssssssss");
        printf("load file=%s, error=%s\n", file, lua_tostring(state, -1));
		return -1;
	}
    printf("success\n");
    return 0;
}
